package com.da.javatest.leetCode;

/**
 * @author chenlida
 * @date 2019/2/16 11:08
 * @description
 */
public class Code459 {
    public static void main(String[] args) {
        System.out.println(new Code459().repeatedSubstringPattern("abab"));
    }

    public boolean repeatedSubstringPattern(String s) {
        String s2 = s;
        int size = s.length() / 2;
        for (int i = 0; i < size; i++) {
            char c = s2.charAt(s2.length() - 1);
            s2 = c + s2.substring(0, s2.length() - 1);
            if (s.equals(s2)) {
                return true;
            }
        }
        return false;
    }
}
